/**
 * grayrabbit Inc.
 * Copyright (c) 2011-2012 All Rights Reserved.
 */
package com.grayrabbit.slacker.config.provider;

import java.io.IOException;
import java.util.Properties;

/**
 * 属性文件操作类
 * 
 * @author liyd
 * @version $Id: PropertiesProvider.java, v 0.1 2012-5-8 下午2:54:33 liyd Exp $
 */
public class PropertiesProvider {

    /** 要加载的配置文件 */
    private final static String PROPERTIES_FILE = "slacker.properties";

    /** 存放配置文件信息对象 */
    private static Properties   properties      = new Properties();

    /**
     * 加载配置文件
     */
    static {

        try {

            properties.load(PropertiesProvider.class.getClassLoader().getResourceAsStream(
                PROPERTIES_FILE));

        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    /**
     * 根据属性key获取配置信息
     * 
     * @param key
     * @return
     */
    public static String getProperty(String key) {
        return properties.getProperty(key);
    }

}
